package com.javaeedev.domain;

import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.Id;
import javax.persistence.JoinColumn;
import javax.persistence.ManyToOne;
import javax.persistence.Table;

import org.hibernate.annotations.GenericGenerator;

/**
 * Ticket for reset password.
 * 
 * @author Xuefeng
 */
@Entity
@Table(name="T_PWDT")
public class PasswordTicket {

    private User user;
    private String ticket;
    private long createdDate;

    private String id;

    @Id
    @Column(nullable=false, updatable=false, length=32)
    @GeneratedValue(generator="system-uuid")
    @GenericGenerator(name="system-uuid", strategy="uuid")
    public String getId() { return id; }
    protected void setId(String id) { this.id = id; }

    @ManyToOne
    @JoinColumn(nullable=false, updatable=false)
    public User getUser() { return user; }
    public void setUser(User user) { this.user = user; }

    @Column(nullable=false, updatable=false, length=32)
    public String getTicket() { return ticket; }
    public void setTicket(String ticket) { this.ticket = ticket; }

    @Column(nullable=false, updatable=false)
    public long getCreatedDate() { return createdDate; }
    public void setCreatedDate(long createdDate) { this.createdDate = createdDate; }

}
